# Maintainer: Filipe Laíns (FFY00) <lains@archlinuc.org>
# Contributor: Johannes Pohl <johannes.pohl90@gmail.com>

pkgname=urh
pkgver=2.9.5
pkgrel=2
pkgdesc='Universal Radio Hacker: investigate wireless protocols like a boss'
arch=('loong64' 'x86_64')
url='https://github.com/jopohl/urh'
license=('GPL3')
depends=('python' 'python-pyqt5' 'python-numpy' 'python-psutil')
makedepends=('cython0' 'gcc' 'python-setuptools' 'airspy' 'hackrf' 'libuhd' 'limesuite' 'rtl-sdr' 'bladerf' 'libiio')
checkdepends=('python-pytest-runner' 'python-pytest-xdist' 'xorg-server-xvfb')
optdepends=('airspy: Airspy backend'
            'cython: compiling native modules inside URH'
            'hackrf: HackRF backend'
            'libuhd: USRP backend'
            'limesuite: LimeSDR backend'
            'rtl-sdr: RTL-SDR backend'
            'gnuradio: GNURadio backend'
            'bladerf: BladeRF backend'
            'python-pylibiio: IIO backend (PlutoSDR)'
            'gnuradio-osmosdr: OsmoSDR backend, via GNURadio'
            'python-pyaudio: Soundcard backend')
source=("$pkgname-$pkgver.tar.gz::https://github.com/jopohl/urh/archive/v$pkgver.tar.gz")
sha512sums=('7f04f041963103aab4a67fd5fd8f874339cad04da846236b0ec4584553ae6b4a6469c2505cec7c67f72d848d0eb90a4996753802c65535914e70a943d40e6970')

build() {
  cd $pkgname-$pkgver

  python setup.py build build_ext
  python src/urh/cythonext/build.py
}

check() {
  cd $pkgname-$pkgver

  xvfb-run pytest
}

package() {
  cd $pkgname-$pkgver

  python setup.py install --root="$pkgdir" -O1 --skip-build

  install -Dm644 ./data/urh.desktop "$pkgdir"/usr/share/applications/urh.desktop
  install -Dm 644 data/icons/appicon.png "$pkgdir"/usr/share/pixmaps/urh.png
  install -Dm 644 README.md "$pkgdir"/usr/share/doc/$pkgname/README
}
